/**
 * Created by Administrator on 2017/3/2 0002.
 */
var Page2={
    create:function () {
    var page={};
        page.ui=new PIXI.DisplayObjectContainer();
        var bg=Easy.CreateSprite('assets/images/p2_bg.png',0,0,0,0,1);
        page.ui.addChild(bg);

        var d0=Easy.CreateSprite('assets/images/p2_d0.png',370,568,0.5,0.5,1);
        page.ui.addChild(d0);
        TweenMax.to(d0.scale,5,{x:1.2,y:1.2,yoyo:true,repeat:-1,repeatDelay:1,ease:Linear.easeNone});

        var d1=Easy.CreateSprite('assets/images/p2_d1.png',0,0,0.0,0.0,0.7);
        page.ui.addChild(d1);
        TweenMax.to(d1,3,{alpha:1,yoyo:true,repeat:-1,repeatDelay:1,ease:Linear.easeNone});
        TweenMax.to(d1,5,{y:10,yoyo:true,repeat:-1,repeatDelay:1,ease:Linear.easeNone});

        var tip=Easy.CreateSprite('assets/images/tip.png',367,1076,0.5,0.5,1);
        TweenMax.to(tip,0.7,{y:1100,yoyo:true,repeat:-1,ease:Cubic.easeInOut});

        var i0=Easy.CreateSprite('assets/images/p2_i0.png',370,933,0.5,0.5,0);
        var i1=Easy.CreateSprite('assets/images/p2_i1.png',370,878,0.5,0.5,0);

        var t0=Easy.CreateSprite('assets/images/p2_t0.png',390,171,0.5,0.5,0);
        var t1=Easy.CreateSprite('assets/images/p2_t1.png',390,225,0.5,0.5,0);
        var t2=Easy.CreateSprite('assets/images/p2_t2.png',390,291,0.5,0.5,0);
        var t3=Easy.CreateSprite('assets/images/p2_t3.png',386,357,0.5,0.5,0);
        var t4=Easy.CreateSprite('assets/images/p2_t4.png',390,477,0.5,0.5,0);

        var light0=Easy.CreateSprite('assets/images/light0.png',281,307,0.5,0.5,1);
        light0.scale.x=light0.scale.y=0;
        light0.blendMode=PIXI.BLEND_MODES.ADD;
        TweenMax.to(light0,3,{x:507,yoyo:true,repeat:-1,repeatDelay:1,ease:Linear.easeNone});

        var light1=Easy.CreateSprite('assets/images/light1.png',528,200,0.5,0.5,0.5);
        light1.scale.x=light1.scale.y=0;
        light1.blendMode=PIXI.BLEND_MODES.ADD;
        TweenMax.to(light1,1,{alpha:1,yoyo:true,repeat:-1,repeatDelay:0.5,ease:Cubic.easeInOut});
        var light2=Easy.CreateSprite('assets/images/light1.png',461,651,0.5,0.5,0.5);
        light2.scale.x=light2.scale.y=0;
        light2.blendMode=PIXI.BLEND_MODES.ADD;
        TweenMax.to(light2,1,{alpha:1,yoyo:true,repeat:-1,repeatDelay:0.5,ease:Cubic.easeInOut});
        page.ui.addChild(i0);
        page.ui.addChild(i1);
        page.ui.addChild(t0);
        page.ui.addChild(t1);
        page.ui.addChild(t2);
        page.ui.addChild(t3);
        page.ui.addChild(t4);
        page.ui.addChild(light0);
        page.ui.addChild(light1);
        page.ui.addChild(light2);
        page.ui.addChild(tip);


        page.In=function () {
            console.log('in');
            i0.alpha=0;
            i0.scale.x=i0.scale.y=2;
            i1.alpha=0;
            i1.scale.x=i1.scale.y=2;
            TweenMax.to(i0,0.9,{delay:0.2*0,alpha:1,ease:Cubic.easeOut});
            TweenMax.to(i1,0.9,{delay:0.2*1,alpha:1,ease:Cubic.easeOut});
            TweenMax.to(i0.scale,0.9,{delay:0.2*0,alpha:1,x:1,y:1,ease:Cubic.easeOut});
            TweenMax.to(i1.scale,0.9,{delay:0.2*1,alpha:1,x:1,y:1,ease:Cubic.easeOut});

            t0.scale.x=t0.scale.y=0;
            t1.scale.x=t1.scale.y=0;
            t2.scale.x=t2.scale.y=0;
            t3.scale.x=t3.scale.y=0;
            t4.scale.x=t4.scale.y=0;
            TweenMax.to(t0.scale,0.9,{delay:0.2*2,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(t0,0.9,{delay:0.2*2,alpha:1,ease:Back.easeOut});
            TweenMax.to(t1.scale,0.9,{delay:0.2*3,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(t1,0.9,{delay:0.2*3,alpha:1,ease:Back.easeOut});
            TweenMax.to(t2.scale,0.9,{delay:0.2*4,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(t2,0.9,{delay:0.2*4,alpha:1,ease:Back.easeOut});
            TweenMax.to(t3.scale,0.9,{delay:0.2*5,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(t3,0.9,{delay:0.2*5,alpha:1,ease:Back.easeOut});
            TweenMax.to(t4.scale,0.9,{delay:0.2*6,x:1,y:1,ease:Back.easeOut});
            TweenMax.to(t4,0.9,{delay:0.2*6,alpha:1,ease:Back.easeOut});

            light0.scale.x=light0.scale.y=0;
            TweenMax.to(light0.scale,0.5,{delay:1.8,x:1,y:1,ease:Back.easeOut});
            light1.scale.x=light1.scale.y=0;
            TweenMax.to(light1.scale,0.5,{delay:1.8,x:1,y:1,ease:Back.easeOut});
            light2.scale.x=light2.scale.y=0;
            TweenMax.to(light2.scale,0.5,{delay:1.6,x:1,y:1,ease:Back.easeOut});
        }
        page.Out=function () {
            console.log('out');
            TweenMax.killTweensOf(i0);
            TweenMax.killTweensOf(i1);
            TweenMax.killTweensOf(t0);
            TweenMax.killTweensOf(t1);
            TweenMax.killTweensOf(t2);
            TweenMax.killTweensOf(t3);
            TweenMax.killTweensOf(t4);
            setTimeout(function () {
                i0.alpha=0;
                i1.alpha=0;
                t0.alpha=0;
                t1.alpha=0;
                t2.alpha=0;
                t3.alpha=0;
                t4.alpha=0;
                light0.scale.x=light0.scale.y=0;
                light1.scale.x=light1.scale.y=0;
                light2.scale.x=light2.scale.y=0;
            })

        }

       
    return page;
    }
}